package com.example.service.impl;

//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mapper.ActivityMapper;
import com.example.mapper.CollectionMapper;
import com.example.pojo.entity.Activity;
import com.example.pojo.entity.Collection;
import com.example.service.ActivityService;
import com.example.service.CollectionService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ActivityServiceImpl implements ActivityService {

    @Resource
    ActivityMapper activityMapper;

    @Override
    public void insert(Activity activity) {
        activityMapper.insert(activity);
    }

    @Override
    public void updateById(Activity activity) {
        activityMapper.updateById(activity);
    }

    @Override
    public void removeById(Integer id) {
        activityMapper.removeById(id);
    }

    @Override
    public void removeBatchByIds(List<Integer> ids) {
        for (Integer id : ids){
            activityMapper.removeById(id);
        }
    }

    @Override
    public List<Activity> list() {
        List<Activity> list = activityMapper.list();
        return list;
    }

    @Override
    public Activity getById(Integer id) {
        Activity activity = activityMapper.getById(id);
        return activity;
    }

    @Override
    public PageInfo<Activity> selectByPage(Integer pageNum, Integer pageSize, String name, Integer showState) {
        PageHelper.startPage(pageNum, pageSize);
        List<Activity> list = activityMapper.selectByPage(name,showState);
        return new PageInfo<>(list);
    }
}
